#ifndef VEHICLECONTROLLER_H
#define VEHICLECONTROLLER_H
#include "base_controller.h"
//#include "slaves/slavevehicle.h"
class VehicleController:public BaseController
{
public:
    VehicleController(MainController *main_controller,
                      const double v_limit, const double w_limit);
    virtual ~VehicleController()override{}

    virtual ErrorCode Update() override;
    virtual bool ParseUsrData(const u_char *buffer, const size_t buffer_len)override;//only usr data, without frame header and crc
    virtual bool PackUsrData(u_char *buffer,size_t &buffer_len) override;            //only usr data, without frame header and crc

    inline std::pair<double,double> GetVehicleCurVel()const;
    void SendTarget2Slave(const double v,const double w);

    void GenVehicleVel(const double px, const double py)const;
private:
    //boost::shared_ptr<SlaveVehicle> slave_;
    //boost::shared_ptr<arm::FSM> fsm_;


private:
    //from master device
    double target_linear_vel_;
    double target_angular_vel_;
    //u_char updated_attr_;

    //from socket
    double cur_linear_vel_;
    double cur_angular_vel_;

private:
    const double v_limit_;
    const double w_limit_;
};
typedef std::shared_ptr<VehicleController> VehicleControllerPtr;

#endif // VEHICLECONTROLLER_H
